// healpool. txt
//Standard script for healing pool.
//Cell 0 - Who is helps. 0 - just friendly. 1 - everyone.
//Cell 1,2 - Stuff done flag. If both are 0, always on. Otherwise, this flag needs to be
// > 0 for the pool to be active.

beginobjectscript; 

variables;

body;

beginstate INIT_STATE;
	break;

beginstate DEAD_STATE;

break;

beginstate START_STATE; // pool dark, waititng
	if (get_memory_cell(0) == 0) {
		if (get_nearest_good_char(2) >= 0) {
			if ((get_memory_cell(1) > 0) || (get_memory_cell(2) > 0)) {
				if (get_flag(get_memory_cell(1),get_memory_cell(2)) == 0) {
					print_str("Healing Pool: It's not working now. It's not charged.");
					end();
					}
				}
			run_sparkles_on_object(ME,3,12,1);
			pc_heard_sound(109);
			run_object_animation(1,1,35);
			heal_nearby(25,2,0);
			set_state(3);
			}
		}
		else {
			if (get_nearest_char(2) >= 0) {
				if ((get_memory_cell(1) > 0) || (get_memory_cell(2) > 0)) {
					if (get_flag(get_memory_cell(1),get_memory_cell(2)) == 0) {
						print_str("Healing Pool: It's not working now. It's not charged.");
						end();
						}
					}
				run_sparkles_on_object(ME,3,12,1);
				pc_heard_sound(109);
				run_object_animation(1,1,35);
				heal_nearby(25,2,2);
				set_state(3);
				}
			}
		

break;

beginstate 3; // pool flaring
	if (am_i_doing_action() == FALSE) {
		set_state(START_STATE);
		}
break;
